package com.exchange.mapper;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.exchange.entity.pojo.PackageRecord;
import com.exchange.entity.pojo.Wallet;
import com.exchange.entity.vo.MyWalletVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
* @author Administrator
* @description 针对表【package_record】的数据库操作Mapper
* @createDate 2024-04-25 20:02:10
* @Entity com.exchange.entity.pojo.PackageRecord
*/
public interface PackageRecordMapper extends BaseMapper<PackageRecord> {

    @Insert("insert into package_record(wid,ptid,vid,patid,expiration_time) values(#{wid},#{ptid},#{vid},#{patid},#{newDate2})")
    void inserts(@Param("wid") Long wid, @Param("ptid") Long ptid, @Param("vid") Long vid, @Param("patid") Long patid, @Param("newDate2") DateTime newDate2);

    @Update("update package_record set expiration_time=#{newDate2} where id=#{id}")
    void updates(@Param("id") Long id,@Param("newDate2") DateTime newDate2);

    MyWalletVo findMyPackageByFourTable(PackageRecord packageRecord);

    @Update("update package_record set expiration_time=#{newDate3} where id=#{id}")
    void updatess(@Param("id")Long id,@Param("newDate3") DateTime newDate3);

    @Update("update package_record set status=1 where ptid=#{id}")
    void updatePackage(Long id);

    @Select("select * from package_record where wid =(select id from wallet where uid=#{id} and status =0 )")
    PackageRecord findPackage(Long id);
}




